package thread.test04.demo02;

/**
 * ClassName: MyRunnable
 * Description:
 *
 * @Author zjl
 * @Create 2025/03/11 19:32
 * @Version 1.0
 */
public class MyRunnable implements Runnable{
    private int tickets = 50;
    @Override
    public void run() {
        while (true) {
            if (tickets > 0) {
                System.out.println(Thread.currentThread().getName() + "正在出售第" + (tickets--) + "张票");
            } else {
                break;
            }
        }
    }
}
